Example #1
0
 def test_sets_correct_is_enabled(self):
     name = self.txt()
     is_enabled = True
     meta = FeatureFlagStoreMeta(self.now, {})
     item = FeatureFlagStoreItem(name, is_enabled, meta)
     serialized = item.serialize()
     deserialized = FeatureFlagStoreItem.deserialize(serialized)
     self.assertEqual(is_enabled, deserialized.is_enabled())
Example #2
0
 def test_returns_instance_of_class(self):
     name = self.txt()
     is_enabled = True
     meta = FeatureFlagStoreMeta(self.now, {})
     item = FeatureFlagStoreItem(name, is_enabled, meta)
     serialized = item.serialize()
     deserialized = FeatureFlagStoreItem.deserialize(serialized)
     self.assertTrue(isinstance(deserialized, FeatureFlagStoreItem))
Example #3
0
 def test_sets_correct_client_data(self):
     name = self.txt()
     is_enabled = True
     client_data = {"foo": "bar"}
     meta = FeatureFlagStoreMeta(self.now, client_data)
     item = FeatureFlagStoreItem(name, is_enabled, meta)
     serialized = item.serialize()
     deserialized = FeatureFlagStoreItem.deserialize(serialized)
     self.assertEqual(client_data, deserialized.to_dict()["meta"]["client_data"])
Example #4
0
 def test_contains_all_fields_from_json(self):
     name = self.txt()
     is_enabled = True
     meta = FeatureFlagStoreMeta(self.now, {})
     item = FeatureFlagStoreItem(name, is_enabled, meta)
     self.assertEqual(json.dumps(item.to_dict()), item.serialize().decode("utf-8"))
Example #5
0
 def test_is_base_64_encoded(self):
     name = self.txt()
     is_enabled = True
     meta = FeatureFlagStoreMeta(self.now, {})
     item = FeatureFlagStoreItem(name, is_enabled, meta)
     self.assertTrue(isinstance(item.serialize().decode("utf-8"), str))