示例#1
0
def test_it_uses_data_dict_entries_in_passed_in_docs_for_columns():
    qs = JustfixUser.objects.values("phone_number")
    d = dd.get_data_dictionary(qs, {"phone_number": example_entry})
    assert d["phone_number"] is example_entry
示例#2
0
 def get_data_dictionary(self, user: JustfixUser) -> DataDictionary:
     return get_data_dictionary(self.get_queryset(user), self.extra_docs)
示例#3
0
def test_it_uses_data_dict_entries_in_passed_in_docs_for_renamed_fields():
    qs = JustfixUser.objects.values(bloop=F("phone_number"))
    d = dd.get_data_dictionary(qs, {"bloop": example_entry})
    assert d["bloop"] is example_entry
示例#4
0
def test_it_uses_data_dict_entries_in_passed_in_docs_for_annotations():
    qs = JustfixUser.objects.values(bloop=example_subquery)
    d = dd.get_data_dictionary(qs, {"bloop": example_entry})
    assert d["bloop"] is example_entry
示例#5
0
def test_it_uses_help_text_from_model_for_annotations_if_possible():
    qs = JustfixUser.objects.values(bloop=F("phone_number"))
    d = dd.get_data_dictionary(qs)
    assert "phone number" in d["bloop"].help_text
示例#6
0
def test_it_prioritizes_passed_in_docs_for_annotations_if_possible():
    qs = JustfixUser.objects.values(bloop=F("phone_number"))
    d = dd.get_data_dictionary(qs, {"bloop": "hallo"})
    assert d["bloop"].help_text == "hallo"
示例#7
0
def test_it_defaults_annotation_docs_to_empty_strings():
    qs = JustfixUser.objects.values(has_onboarding_info=example_subquery)
    d = dd.get_data_dictionary(qs)
    assert d["has_onboarding_info"].help_text == ""
示例#8
0
def test_it_uses_passed_in_docs_for_annotations():
    qs = JustfixUser.objects.values(has_onboarding_info=example_subquery)
    d = dd.get_data_dictionary(qs, {"has_onboarding_info": "Whether the user has been onboarded."})
    assert d["has_onboarding_info"].help_text == "Whether the user has been onboarded."
示例#9
0
def test_it_prioritizes_passed_in_docs():
    qs = JustfixUser.objects.values("phone_number")
    d = dd.get_data_dictionary(qs, {"phone_number": "blarg"})
    assert d["phone_number"].help_text == "blarg"
示例#10
0
def test_it_uses_help_text_from_model():
    qs = JustfixUser.objects.values("phone_number")
    d = dd.get_data_dictionary(qs)
    assert "phone number" in d["phone_number"].help_text
示例#11
0
def test_it_uses_hard_coded_docs():
    qs = JustfixUser.objects.values("id")
    d = dd.get_data_dictionary(qs)
    assert "unique id" in d["id"].help_text