Пример #1
0
class TestAtlasSource(unittest.TestCase):

    def setUp(self):
        self.kwargs = {"requested": 5, "value": "test", "type": "country"}
        self.source = AtlasSource(**self.kwargs)

    def test_setting_type(self):
        self.assertRaises(
            MalFormattedSource, lambda: setattr(self.source, "type", "testing")
        )

    def test_clean(self):
        self.assertEqual(self.source.clean(), None)
        self.source.type = "msm"
        self.source.value = None
        self.assertRaises(
            MalFormattedSource, lambda: self.source.clean()
        )
        self.source.value = "test"
        self.source.requested = None
        self.assertRaises(
            MalFormattedSource, lambda: self.source.clean()
        )

    def test_build_api_struct(self):
        self.assertEqual(self.source.build_api_struct(), self.kwargs)
        validate(self.source.build_api_struct(), probes_create_schema)
Пример #2
0
 def test_build_api_struct_with_tags(self):
     kwargs = {
         "requested": 5, "value": "test", "type": "msm",
         "tags": {"include": ["one", "two"], "exclude": ["one", "two"]}
     }
     source = AtlasSource(**kwargs)
     self.assertEqual(source.build_api_struct(), kwargs)
     validate(source.build_api_struct(), probes_create_schema)
Пример #3
0
 def test_build_api_struct(self):
     kwargs = {"requested": 5, "value": "test", "type": "msm"}
     source = AtlasSource(**kwargs)
     self.assertEqual(source.build_api_struct(), kwargs)
     validate(source.build_api_struct(), probes_create_schema)
Пример #4
0
 def test_build_api_struct(self):
     kwargs = {"requested": 5, "value": "test", "type": "msm"}
     source = AtlasSource(**kwargs)
     self.assertEqual(source.build_api_struct(), kwargs)
     validate(source.build_api_struct(), probes_create_schema)