Example #1
0
 def test_non_existing_user(self):
     print('non_existing_user')
     self.setup(gen_key())
     self.assertEqual(
         self.response.status_code,
         404  # Not Found
     )
Example #2
0
 def test_bad_link(self):
     print('bad_link')
     self.setup(gen_key())
     self.assertEqual(
         self.response.status_code,
         404  # Not Found
     )
Example #3
0
 def test_invalid_code(self):
     print('invalid_code')
     athlete = create_athlete(self.data)
     set_key(athlete.user)
     url = reverse('pass change prep',
                   kwargs={
                       'slug': 'sharlon-regales',
                       'code': gen_key()
                   })
     with self.assertRaises(LookupError):
         self.client.get(url)
Example #4
0
class Link(Document):
    """
    Link representation.
    """

    meta = {'collection': 'links'}

    short_id = StringField(default=lambda: utils.gen_key())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    created = StringField(default=lambda: utils.get_time())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    board_id = StringField()
    """
    :type: *str*
    :required: True
    :default: None
    """

    pith = StringField(required=True)
    """
    :type: *str*
    :required: True
    :default: None
    """

    source = StringField()
    """
    :type: *str*
    :required: True
    :default: None
    """

    target = StringField()
    """
    :type: *str*
    :required: True
    :default: None
    """

    id = StringField(default="", primary_key=True)
Example #5
0
class Discussion(Document):
    """
    Discussion representation.
    """

    meta = {'collection': 'discussions'}

    short_id = StringField(default=lambda: utils.gen_key())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    created = StringField(default=lambda: utils.get_time())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    board_id = StringField()
    """
    :type: *str*
    :required: True
    :default: None
    """

    chat = ListField(StringField(), default=[])  # unit ids
    """
    :type: *List[str]*
    :required: False
    :default: []
    """

    pinned = ListField(StringField(), default=[])  # unit ids
    """
    :type: *List[str]*
    :required: False
    :default: []
    """

    focused = ListField(StringField(), default=[])  # unit ids
    """
    :type: *List[str]*
    :required: False
    :default: []
    """

    id = StringField(default="", primary_key=True)
Example #6
0
class Board(Document):
    """
    Board representation.
    """

    meta = {'collection': 'boards'}

    short_id = StringField(default=lambda: utils.gen_key())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    created = StringField(default=lambda: utils.get_time())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    id = StringField(default="", primary_key=True)
Example #7
0
class User(Document):
    """
    User representation.
    """

    meta = {'collection': 'users'}

    short_id = StringField(default=lambda: utils.gen_key())

    created = StringField(default=lambda: utils.get_time())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    board_id = StringField()
    """
    :type: *str*
    :required: True
    :default: None
    """

    discussion_id = StringField()
    """
    :type: *str*
    :required: False
    :default: None
    """

    nickname = StringField(required=True)
    """
    :type: *str*
    :required: True
    :default: None
    """

    id = StringField(default="", primary_key=True)
Example #8
0
class UnitUpdate(Document):
    """
    Unit-update representation.
    """

    meta = {'collection': 'unit_updates'}

    short_id = StringField(default=lambda: utils.gen_key())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    created = StringField(default=lambda: utils.get_time())
    """
    :type: *datetime*
    :required: False
    :default: Automatically generated.
    """

    board_id = StringField()
    """
    :type: *str*
    :required: True
    :default: None
    """

    unit_id = StringField()
    """
    :type: *str*
    :required: True
    :default: None
    """

    id = StringField(default="", primary_key=True)
Example #9
0
class Unit(Document):
    """
    Unit representation.
    Text-searchable over `pith`.
    """

    meta = {'collection': 'units'}

    short_id = StringField(default=lambda: utils.gen_key())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    created = StringField(default=lambda: utils.get_time())
    """
    :type: *str*
    :required: False
    :default: Automatically generated.
    """

    board_id = StringField()
    """
    :type: *str*
    :required: True
    :default: None
    """

    pith = StringField(required=True)
    """
    :type: *str*
    :required: True
    :default: None
    """

    position = EmbeddedDocumentField(Position)

    chat = BooleanField(default=False)  # versus in document
    """
    :type: *bool*
    :required: False
    :default: False
    """

    author = StringField()
    """
    :type: *str*
    :required: False
    :default: None
    """

    author_name = StringField()
    """
    :type: *str*
    :required: False
    :default: None
    """

    flairs = ListField(StringField(), default=[])
    """
    :type:
    :required: False
    :default: []
    """

    hidden = BooleanField(default=False)
    """
    :type: *bool*
    :required: False
    :default: False
    """

    notice = BooleanField(default=False)
    """
    :type: *bool*
    :required: False
    :default: False
    """

    id = StringField(default="", primary_key=True)