summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource/test_maas.py
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize unit test locations under tests/unittests (#1126)Brett Holman2021-12-031-200/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This attempts to standardize unit test file location under test/unittests/ such that any source file located at cloudinit/path/to/file.py may have a corresponding unit test file at test/unittests/path/to/test_file.py. Noteworthy Comments: ==================== Four different duplicate test files existed: test_{gpg,util,cc_mounts,cc_resolv_conf}.py Each of these duplicate file pairs has been merged together. This is a break in git history for these files. The test suite appears to have a dependency on test order. Changing test order causes some tests to fail. This should be rectified, but for now some tests have been modified in tests/unittests/config/test_set_passwords.py. A helper class name starts with "Test" which causes pytest to try executing it as a test case, which then throws warnings "due to Class having __init__()". Silence by changing the name of the class. # helpers.py is imported in many test files, import paths change cloudinit/tests/helpers.py -> tests/unittests/helpers.py # Move directories: cloudinit/distros/tests -> tests/unittests/distros cloudinit/cmd/devel/tests -> tests/unittests/cmd/devel cloudinit/cmd/tests -> tests/unittests/cmd/ cloudinit/sources/helpers/tests -> tests/unittests/sources/helpers cloudinit/sources/tests -> tests/unittests/sources cloudinit/net/tests -> tests/unittests/net cloudinit/config/tests -> tests/unittests/config cloudinit/analyze/tests/ -> tests/unittests/analyze/ # Standardize tests already in tests/unittests/ test_datasource -> sources test_distros -> distros test_vmware -> sources/vmware test_handler -> config # this contains cloudconfig module tests test_runs -> runs
* cloudinit/tests: remove unneeded with_logs configuration (#263)Daniel Watkins2020-03-191-1/+0
| | | | | | | | | | | These classes don't use `self.logs` anywhere in their body, so we can remove the `with_logs = True` setting from them. These instances were found using astpath[0], with the following invocation: astpath "//Name[@id='with_logs' and not(ancestor::ClassDef//Attribute[@attr='logs'])]" [0] https://github.com/hchasestevens/astpath
* Replace mock library with unittest.mock (#186)Daniel Watkins2020-01-291-1/+1
| | | | | | | | * cloudinit: replace "import mock" with "from unittest import mock" * test-requirements.txt: drop mock Co-authored-by: Chad Smith <chad.smith@canonical.com>
* pylint: pay attention to unused variable warnings.Scott Moser2018-04-191-2/+2
| | | | | This enables warnings produced by pylint for unused variables (W0612), and fixes the existing errors.
* MAAS: add check_instance_id based off oauth tokens.Scott Moser2018-01-101-7/+46
| | | | | | | | | This stores a hash of the OAuth tokens as an 'id' for the maas datasource. Since new instances get new tokens created and those tokens are written by curtin into datasource system config this will provide a way to identify a new "instance" (install). LP: #1712680
* relocate tests/unittests/helpers.py to cloudinit/testsLars Kellogg-Stedman2017-09-051-1/+1
| | | | | This moves the base test case classes into into cloudinit/tests and updates all the corresponding imports.
* flake8: move the pinned version of flake8 up to 3.3.0Scott Moser2017-05-231-1/+1
| | | | | | | | | | | | | | | | This just moves flake8 and related tools up to newer versions and fixes the complaints associated with that. We added to the list of flake8 ignores: H102: do not put vim info in source files H304: no relative imports Also updates and pins the following in the flake8 environment: pep8: 1.7.0 => drop (although hacking still pulls it in). pyflakes 1.1.0 => 1.5.0 hacking 0.10.2 => 0.13.0 flake8 2.5.4 => 3.3.0 pycodestyle none => 2.3.1
* LICENSE: Allow dual licensing GPL-3 or Apache 2.0Jon Grimm2016-12-221-0/+2
| | | | | | | | | | | | | | | | | | This has been a recurring ask and we had initially just made the change to the cloud-init 2.0 codebase. As the current thinking is we'll just continue to enhance the current codebase, its desirable to relicense to match what we'd intended as part of the 2.0 plan here. - put a brief description of license in LICENSE file - put full license versions in LICENSE-GPLv3 and LICENSE-Apache2.0 - simplify the per-file header to reference LICENSE - tox: ignore H102 (Apache License Header check) Add license header to files that ship. Reformat headers, make sure everything has vi: at end of file. Non-shipping files do not need the copyright header, but at the moment tests/ have it.
* MAAS: add vendor-data supportScott Moser2016-08-121-65/+62
| | | | | | | | | | Add vendor-data support to maas which will behave like the openstack vendor-data does. Data returned from maas must be yaml loadable. Also update the main in DataSourceMAAS to "just work" on a maas deployed system. LP: #1612313
* run flake8 instead of pyflakes in tox. expect tests/ to pass flake8.Scott Moser2016-05-121-2/+2
|
* Update pep8 runner and fix pep8 issuesRyan Harper2016-03-031-8/+8
|
* hopefully fix DataSourceMAASScott Moser2015-08-071-1/+1
|
* move towards user-data being binaryScott Moser2015-02-251-4/+4
| | | | | | | | | | | | | | | | UrlResponse: biggest change... make readurl return bytes, making user know what to do with it. util: add load_tfile_or_url for loading text file or url as read_file_or_url now returns bytes ec2_utils: all meta-data is text, remove non-obvious string translations DigitalOcean: adjust for ec2_utils DataSourceGCE, DataSourceMAAS: user-data is binary other fields are text. openstack.py: read paths without decoding to text. This is ok as paths other than user-data are json, and load_json will handle load_file still returns text, and that is what most things use.
* Repair the Python 2.6 tests.Barry Warsaw2015-01-261-3/+2
|
* Port the MAAS code to oauthlib.Barry Warsaw2015-01-261-6/+1
|
* * More str/bytes fixes.Barry Warsaw2015-01-261-1/+6
| | | | * Temporarily skip the MAAS tests in py3 since they need to be ported to oauthlib.
* More test ports from mocker to mock.Barry Warsaw2015-01-221-28/+47
|
* moreDimitri John Ledkov2014-07-231-1/+1
|
* moreDimitri John Ledkov2014-07-231-1/+1
|
* pyflakes cleanups0.7.5Scott Moser2014-04-011-1/+0
|
* read_file_or_url: raise UrlError with 404 on ENOENTScott Moser2014-01-241-1/+1
| | | | | | This makes it easier to call read_file_or_url and handle file or url errors. Now read_file_or_url will raise a UrlError in either case on errors.
* Skip retry and continued fetch of userdata when NOT_FOUNDJoshua Harlow2014-01-231-1/+2
| | | | | | | | When a 404 http code comes back from the fetching of ec2 data, instead of retrying immediatly stop the fetching process and in the userdata fetching function handle this case as a special case of no userdata being fetched (an empty string in this case).
* fix testScott Moser2013-04-251-2/+3
|
* Get tests working and further adjustments.harlowja2013-02-231-4/+7
|
* more test cases for nocloud including one for config seedScott Moser2013-02-071-7/+1
|
* fix pep8 complaints.Scott Moser2012-08-221-11/+11
| | | | make pep8 now is silent on precise's pep8 ( 0.6.1-2ubuntu2).
* stright forward pylint cleanups to tests/ and tools/Scott Moser2012-08-091-2/+0
|
* Get this test working again.Joshua Harlow2012-06-211-34/+30
|
* add supprot for reading public-keys from DataSourcMAASScott Moser2012-03-161-1/+3
|
* rename DataSourceMaaS to DataSourceMAAS, generally use MAAS everywhereScott Moser2012-03-161-15/+15
| | | | | instead of MaaS or Maas, use MAAS consistently. The only non 'MAAS' left are all lower case.
* pep8 and pylintScott Moser2012-03-081-6/+8
|
* add a test for read_maas_seed_urlScott Moser2012-03-081-2/+36
|
* fix tests for 'hostname' to 'local-hostname' and user-data not requiredScott Moser2012-03-081-6/+6
|
* fix pylint and pep8 warningsScott Moser2012-03-071-1/+1
|
* file for user-data should be 'user-data' (including the '-')Scott Moser2012-03-061-7/+7
|
* assert that userdata is not returned as part of metadataScott Moser2012-03-061-0/+3
|
* Add initial DataSourceMaaS.Scott Moser2012-03-061-0/+112
Tests at this point seem to indicate that seed-dir would work.