示例#1
0
 def test__get_reference_models(self):
     self.assertEqual(
         list(_get_reference_models(Parent, {Parent: {
             Child: ["parent"]
         }})),
         [(Child, ["parent"])],
     )
示例#2
0
 def test__get_reference_models_multiple_fields(self):
     self.assertEqual(
         list(
             _get_reference_models(Parent,
                                   {Parent: {
                                       Child: ["parent", "foo"]
                                   }})),
         [(Child, ["parent", "foo"])],
     )
示例#3
0
 def test__get_reference_models_versioned(self):
     versionable = Mock(
         grouper_model="GrouperModel",
         grouper_field=Mock(remote_field=Mock(get_accessor_name=Mock(
             return_value="contentmodel"))),
     )
     with patch.object(helpers,
                       "get_versionable_for_content",
                       return_value=versionable):
         self.assertEqual(
             list(
                 _get_reference_models(
                     Parent, {"GrouperModel": {
                         Child: ["parent", "foo"]
                     }})),
             [(Child, ["parent__contentmodel", "foo__contentmodel"])],
         )