Esempio n. 1
0
def test_node_update_increments_checkin_count():
    node = Node(name="test node")
    node.save()

    assert node.total_checkins == 0

    node.update()
    node.update()

    assert node.total_checkins == 2
Esempio n. 2
0
    def handle(self, *args, **options):
        try:
            if len(options["node_name"]) != 1:
                raise CommandError("only one node name is accepted")
        except KeyError:
            raise CommandError("node_name required")

        node_name = options["node_name"][0]
        try:
            node = Node.objects.get(name=node_name)
        except Node.DoesNotExist:
            node = Node(name=node_name)
            node.save()

        node.update()
        print(node.external_classify())